package com.bbf.db.multiple.util;

import com.bbf.db.multiple.base.DruidCommonConfiguration;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Druid监控配置类
 */
@Configuration
public class DruidConfiguration {
  /**
   * 注册一个StatViewServlet
   * @return Druid监控Servlet
   */
  @Bean(name = "druidStatViewServlet")
  public ServletRegistrationBean druidStatViewServlet() {
    return DruidCommonConfiguration.druidStatViewServlet();
  }

  /**
   * 注册Druid的Stat过滤器
   * @return Druid的Stat过滤器
   */
  @Bean(name = "druidStatFilter")
  public FilterRegistrationBean druidStatFilter() {
    return DruidCommonConfiguration.druidStatFilter();
  }
}
